// State values:
// 4 = User given destination		green
// 3 = Robot position				red
// 2 = Occupied						orange
// 1 = Free							blue		
// 0 = Unknown						dark grey

public class Map {
	int xSize;
	int ySize;
	Integer map[][];
	
	/**
	 * The constructor initialize the state map 
	 * @param xSize The with of the map.
	 * @param ySize The height of the map.
	 */
	public Map(int xSize,int ySize) {
		this.xSize = xSize;
		this.ySize = ySize;
		map = new Integer[xSize][ySize];
		for (int i = 0;i<xSize;i++){
			for (int j = 0;j<ySize;j++){
				map[i][j] = 0;
			}
		}
	}
	
	/**
	 * Sets the state of an element in the state map at given position.
	 * Description of the different states:
	 * 4 = User given destination	Color on the map: green
	 * 3 = Robot position			Color on the map: red
	 * 2 = Occupied					Color on the map: orange
	 * 1 = Free						Color on the map: blue		
	 * 0 = Unknown					Color on the map: dark grey
	 * @param x The x-coordinate of the element which state should be set.
	 * @param y The y-coordinate of the element which state should be set.
	 */
	public void  setStateAt(int x,int y, Integer stateValue){
		if (x > 0 && x < xSize && y > 0 && y < ySize){
			map[x][y] = stateValue;
		}
		else{
			System.out.println("Error: Trying to set value outside the maps dimension.");
		}
	}

	/**
	 * Gets the state of an element in the state map at given position.
	 * @param x The x-coordinate of the element which state should be returned.
	 * @param y The y-coordinate of the element which state should be returned.
	 */
	public Integer getStateAt(int x, int y){
		return map[x][y];
	}	
}
